package com.ticket.sass.common.douyin.openapi.resposne

import com.google.gson.annotations.SerializedName
import com.ticket.sass.common.douyin.openapi.enums.CertificateStatus
import java.time.LocalDateTime

data class VerifyCouponPrepareData(
    @SerializedName("verify_token") val verifyToken: String?,
    @SerializedName("certificates") val certificates: List<Certificate>?,
    @SerializedName("order_id") val orderId: String,
) : ApiResponseBaseData() {
    data class Certificate(
        @SerializedName("encrypted_code") val encryptedCode: String,
        @SerializedName("expire_time") val expireTime: Long,
        @SerializedName("sku") val sku: Sku,
        @SerializedName("amount") val amount: Amount,
        @SerializedName("status") val status: CertificateStatus,
    ) {
        fun isAvailable(): Boolean {
            return expireTime > LocalDateTime.now().second
        }

    }

    data class Sku(
        @SerializedName("title") val title: String,
        @SerializedName("account_id") val accountId: String,
        @SerializedName("market_price") val marketPrice: Int,
        @SerializedName("sku_id") val skuId: String,
        @SerializedName("sold_start_time") val soldStartTime: Long,
        @SerializedName("third_sku_id") val thirdSkuId: String
    )

    data class Amount(
        @SerializedName("original_amount") val originalAmount: Int,
        @SerializedName("pay_amount") val payAmount: Int,
        @SerializedName("merchant_ticket_amount") val merchantTicketAmount: Int,
        @SerializedName("payment_discount_amount") val paymentDiscountAmount: Int,
        @SerializedName("coupon_pay_amount") val couponPayAmount: Int
    )

//    data class NotAvailableTimeInfo(
//
//    )
}

